import 'package:flutter/material.dart';

class Help extends StatelessWidget {
  final List<Map<String, String>> helpList = [
    {'name': 'Test article'},
    {'name': '我们接受什么样的付款方式?'},
    {'name': '我什么时候需要预订?'},
    {'name': '如何编辑或删除付款方式?'}
  ];

  @override
  Widget build(BuildContext context) {
    final size = MediaQuery.of(context).size;
    return Scaffold(
      appBar: AppBar(),
      body: SingleChildScrollView(
        child: Column(
          children: setWidget(size),
        ),
      ),
    );
  }

  List<Widget> setWidget(size) {
    List<Widget> widgets = new List();
    widgets.add(ListTile(title: Text('What help do you need?', style: TextStyle(fontSize: 20))));
    widgets.add(SizedBox(height: 10));
    widgets.add(Container(
        height: 50,
        width: size.width - 30,
        child: Form(
          child: TextFormField(
            decoration: InputDecoration(
                filled: true,
                prefixIcon: Icon(Icons.search),
                fillColor: Colors.transparent,
                border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(30),
                    borderSide: BorderSide()),
                hintText: 'Search help articles'),
            style: TextStyle(textBaseline: TextBaseline.alphabetic),
            keyboardType: TextInputType.emailAddress,
          ),
        )));
    widgets.add(SizedBox(height: 20));
    widgets
        .add(ListTile(title: Text('Testaaa', style: TextStyle(fontSize: 20))));
    for (var item in helpList) {
      widgets.add(ListTile(
          title: Text(item['name']), trailing: Icon(Icons.arrow_forward_ios)));
      widgets.add(Divider());
    }
    widgets.add(ListTile(title: Text('信任和安全', style: TextStyle(fontSize: 20))));
    widgets.add(Divider());
    widgets.add(ListTile(
        title: Text('我是顾客，有什么安全提示需要我注意'),
        trailing: Icon(Icons.arrow_forward_ios)));
    widgets.add(SizedBox(height: 20));
    return widgets;
  }
}
